﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 申请登记信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_APP_REGINFO: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_APP_REGINFO()
		{}
		#region Model
		private long _id;
		private string _custname;
		private string _custno;
		private string _linkman;
		private string _linkmantel;
		private string _source;
		private long _salesmanid;
		private string _salesman;
		private long _mediatorid;
		private string _mediator;
		private int _fieldproject;
		private int _busstype;
		private long _productid;
		private string _productname;
		private int _loanphase;
		private int _loanphasetype;
		private Nullable<DateTime> _regdate;
		private string _regman;
		private decimal _intemtionamt;
		private string _importantlevel;
		private string _remark;
		private Nullable<DateTime> _lastflowdate;
		private int _status;
		private int _issystemstop;
		private string _stopby;
		private Nullable<DateTime> _stopdate;
		private long _depid;
		private string _depname;
		private int _systemid;
		private string _modifyby;
		private Nullable<DateTime> _modifydate;
		private int _deleteflag;
		private string _deleteby;
		private Nullable<DateTime> _deletedate;
		private int _sparefield1;
		private string _sparefield2;
		private string _sparefield3;
        
		/// <summary>
		/// 主键ID    主键ID，唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 客户名称    
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 证件号码    
		/// </summary>
		[DataMember]
		public string CUSTNO
		{
			get{return _custno;}
			set{
				if ( _custno!= value)
				{
					 _custno = value;
					OnPropertyChanged("CUSTNO");
				}
			}
		}
		/// <summary>
		/// 联系人    
		/// </summary>
		[DataMember]
		public string LINKMAN
		{
			get{return _linkman;}
			set{
				if ( _linkman!= value)
				{
					 _linkman = value;
					OnPropertyChanged("LINKMAN");
				}
			}
		}
		/// <summary>
		/// 联系人手机    
		/// </summary>
		[DataMember]
		public string LINKMANTEL
		{
			get{return _linkmantel;}
			set{
				if ( _linkmantel!= value)
				{
					 _linkmantel = value;
					OnPropertyChanged("LINKMANTEL");
				}
			}
		}
		/// <summary>
		/// 来源渠道    下拉输入，必填项，默认包括‘公司转介、中介介绍、自主开发、自来客户、其他’，如果来源渠道选择‘中介介绍’，则必须输入‘中介人’（待定）
		/// </summary>
		[DataMember]
		public string SOURCE
		{
			get{return _source;}
			set{
				if ( _source!= value)
				{
					 _source = value;
					OnPropertyChanged("SOURCE");
				}
			}
		}
		/// <summary>
		/// 业务员记录ID    
		/// </summary>
		[DataMember]
		public long SALESMANID
		{
			get{return _salesmanid;}
			set{
				if ( _salesmanid!= value)
				{
					 _salesmanid = value;
					OnPropertyChanged("SALESMANID");
				}
			}
		}
		/// <summary>
		/// 业务员    
		/// </summary>
		[DataMember]
		public string SALESMAN
		{
			get{return _salesman;}
			set{
				if ( _salesman!= value)
				{
					 _salesman = value;
					OnPropertyChanged("SALESMAN");
				}
			}
		}
		/// <summary>
		/// 中介人记录ID    
		/// </summary>
		[DataMember]
		public long MEDIATORID
		{
			get{return _mediatorid;}
			set{
				if ( _mediatorid!= value)
				{
					 _mediatorid = value;
					OnPropertyChanged("MEDIATORID");
				}
			}
		}
		/// <summary>
		/// 中介人    
		/// </summary>
		[DataMember]
		public string MEDIATOR
		{
			get{return _mediator;}
			set{
				if ( _mediator!= value)
				{
					 _mediator = value;
					OnPropertyChanged("MEDIATOR");
				}
			}
		}
		/// <summary>
		/// 外地项目    0本地项目，1外地项目
		/// </summary>
		[DataMember]
		public int FIELDPROJECT
		{
			get{return _fieldproject;}
			set{
				if ( _fieldproject!= value)
				{
					 _fieldproject = value;
					OnPropertyChanged("FIELDPROJECT");
				}
			}
		}
		/// <summary>
		/// 业务种类    单选项，包括：典当、期间借款、赎楼、租赁(典当系统里不显示)，必填项
		/// </summary>
		[DataMember]
		public int BUSSTYPE
		{
			get{return _busstype;}
			set{
				if ( _busstype!= value)
				{
					 _busstype = value;
					OnPropertyChanged("BUSSTYPE");
				}
			}
		}
		/// <summary>
		/// 贷款产品    
		/// </summary>
		[DataMember]
		public long PRODUCTID
		{
			get{return _productid;}
			set{
				if ( _productid!= value)
				{
					 _productid = value;
					OnPropertyChanged("PRODUCTID");
				}
			}
		}
		/// <summary>
		/// 贷款产品名称    
		/// </summary>
		[DataMember]
		public string PRODUCTNAME
		{
			get{return _productname;}
			set{
				if ( _productname!= value)
				{
					 _productname = value;
					OnPropertyChanged("PRODUCTNAME");
				}
			}
		}
		/// <summary>
		/// 贷款期限    
		/// </summary>
		[DataMember]
		public int LOANPHASE
		{
			get{return _loanphase;}
			set{
				if ( _loanphase!= value)
				{
					 _loanphase = value;
					OnPropertyChanged("LOANPHASE");
				}
			}
		}
		/// <summary>
		/// 贷款期限类型    0天，1月，默认为1
		/// </summary>
		[DataMember]
		public int LOANPHASETYPE
		{
			get{return _loanphasetype;}
			set{
				if ( _loanphasetype!= value)
				{
					 _loanphasetype = value;
					OnPropertyChanged("LOANPHASETYPE");
				}
			}
		}
		/// <summary>
		/// 登记时间    
		/// </summary>
		[DataMember]
		public Nullable<DateTime> REGDATE
		{
			get{return _regdate;}
			set{
				if ( _regdate!= value)
				{
					 _regdate = value;
					OnPropertyChanged("REGDATE");
				}
			}
		}
		/// <summary>
		/// 登记人    
		/// </summary>
		[DataMember]
		public string REGMAN
		{
			get{return _regman;}
			set{
				if ( _regman!= value)
				{
					 _regman = value;
					OnPropertyChanged("REGMAN");
				}
			}
		}
		/// <summary>
		/// 意向贷款金额    
		/// </summary>
		[DataMember]
		public decimal INTEMTIONAMT
		{
			get{return _intemtionamt;}
			set{
				if ( _intemtionamt!= value)
				{
					 _intemtionamt = value;
					OnPropertyChanged("INTEMTIONAMT");
				}
			}
		}
		/// <summary>
		/// 重要级别    
		/// </summary>
		[DataMember]
		public string IMPORTANTLEVEL
		{
			get{return _importantlevel;}
			set{
				if ( _importantlevel!= value)
				{
					 _importantlevel = value;
					OnPropertyChanged("IMPORTANTLEVEL");
				}
			}
		}
		/// <summary>
		/// 备注    
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 最后跟进时间    
		/// </summary>
		[DataMember]
		public Nullable<DateTime> LASTFLOWDATE
		{
			get{return _lastflowdate;}
			set{
				if ( _lastflowdate!= value)
				{
					 _lastflowdate = value;
					OnPropertyChanged("LASTFLOWDATE");
				}
			}
		}
		/// <summary>
		/// 状态    1跟进中
        ///4中止、3申请被拒绝、5已取消
        ///10已提交立项申请
        ///11已立项(业务部的总经理审批同意后)、
        ///20管理层审批中
        ///30审批同意、
        ///40合同已签订、
        ///50已放款、
        ///60已结清。
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 是否系统中止    0为非中止，1为系统中止，2人为中止
		/// </summary>
		[DataMember]
		public int ISSYSTEMSTOP
		{
			get{return _issystemstop;}
			set{
				if ( _issystemstop!= value)
				{
					 _issystemstop = value;
					OnPropertyChanged("ISSYSTEMSTOP");
				}
			}
		}
		/// <summary>
		/// 中止人    
		/// </summary>
		[DataMember]
		public string STOPBY
		{
			get{return _stopby;}
			set{
				if ( _stopby!= value)
				{
					 _stopby = value;
					OnPropertyChanged("STOPBY");
				}
			}
		}
		/// <summary>
		/// 中止时间    
		/// </summary>
		[DataMember]
		public Nullable<DateTime> STOPDATE
		{
			get{return _stopdate;}
			set{
				if ( _stopdate!= value)
				{
					 _stopdate = value;
					OnPropertyChanged("STOPDATE");
				}
			}
		}
		/// <summary>
		/// 所属部门记录ID    
		/// </summary>
		[DataMember]
		public long DEPID
		{
			get{return _depid;}
			set{
				if ( _depid!= value)
				{
					 _depid = value;
					OnPropertyChanged("DEPID");
				}
			}
		}
		/// <summary>
		/// 所属部门名称    
		/// </summary>
		[DataMember]
		public string DEPNAME
		{
			get{return _depname;}
			set{
				if ( _depname!= value)
				{
					 _depname = value;
					OnPropertyChanged("DEPNAME");
				}
			}
		}
		/// <summary>
		/// 所属子系统    1典当，2信贷，3担保
		/// </summary>
		[DataMember]
		public int SYSTEMID
		{
			get{return _systemid;}
			set{
				if ( _systemid!= value)
				{
					 _systemid = value;
					OnPropertyChanged("SYSTEMID");
				}
			}
		}
		/// <summary>
		/// 修改人    
		/// </summary>
		[DataMember]
		public string MODIFYBY
		{
			get{return _modifyby;}
			set{
				if ( _modifyby!= value)
				{
					 _modifyby = value;
					OnPropertyChanged("MODIFYBY");
				}
			}
		}
		/// <summary>
		/// 修改时间    
		/// </summary>
		[DataMember]
		public Nullable<DateTime> MODIFYDATE
		{
			get{return _modifydate;}
			set{
				if ( _modifydate!= value)
				{
					 _modifydate = value;
					OnPropertyChanged("MODIFYDATE");
				}
			}
		}
		/// <summary>
		/// 是否删除    0否,1是
		/// </summary>
		[DataMember]
		public int DELETEFLAG
		{
			get{return _deleteflag;}
			set{
				if ( _deleteflag!= value)
				{
					 _deleteflag = value;
					OnPropertyChanged("DELETEFLAG");
				}
			}
		}
		/// <summary>
		/// 删除人    
		/// </summary>
		[DataMember]
		public string DELETEBY
		{
			get{return _deleteby;}
			set{
				if ( _deleteby!= value)
				{
					 _deleteby = value;
					OnPropertyChanged("DELETEBY");
				}
			}
		}
		/// <summary>
		/// 删除时间    
		/// </summary>
		[DataMember]
		public Nullable<DateTime> DELETEDATE
		{
			get{return _deletedate;}
			set{
				if ( _deletedate!= value)
				{
					 _deletedate = value;
					OnPropertyChanged("DELETEDATE");
				}
			}
		}
		/// <summary>
		/// 预留字段1    
		/// </summary>
		[DataMember]
		public int SPAREFIELD1
		{
			get{return _sparefield1;}
			set{
				if ( _sparefield1!= value)
				{
					 _sparefield1 = value;
					OnPropertyChanged("SPAREFIELD1");
				}
			}
		}
		/// <summary>
		/// 预留字段2    
		/// </summary>
		[DataMember]
		public string SPAREFIELD2
		{
			get{return _sparefield2;}
			set{
				if ( _sparefield2!= value)
				{
					 _sparefield2 = value;
					OnPropertyChanged("SPAREFIELD2");
				}
			}
		}
		/// <summary>
		/// 预留字段3    
		/// </summary>
		[DataMember]
		public string SPAREFIELD3
		{
			get{return _sparefield3;}
			set{
				if ( _sparefield3!= value)
				{
					 _sparefield3 = value;
					OnPropertyChanged("SPAREFIELD3");
				}
			}
		}

       
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

